money = 5000000
name = input("请输入您的姓名：")
def menu():
    print("-"*50, "主菜单", "-"*50)
    print(f"{name}，您好，欢迎来到黑马银行ATM。请选择操作：")
    print("查询余额", " "*7, "【输入1】")
    print("存款", " "*10, "【输入2】")
    print("取款", " "*10, "【输入3】")
    print("退出", " "*10, "【输入4】")
    global shuru
    shuru = input("请输入您的选择：")
    return shuru
def yue():
    global money
    if shuru == "1":
        print("-"*50, "查询余额", "-"*50)
        print(f"{name}，您好，您的余额剩余{money}元。")
    elif shuru == "2":
        num = int(input("您要存多少钱？"))
        money += num
        print(f"{name}，您好，您存款{num}元成功。")
        print(f"{name}，您好，您的余额剩余{money}元。")
    elif shuru == "3":
        num = int(input("您要取多少钱？"))
        money -= num
        print(f"{name}，您好，您取款{num}元成功。")
        print(f"{name}，您好，您的余额剩余{money}元。")
    elif shuru == "4":
        code = 1
        print("已退出")
        return code
while True:
    if menu() not in  { "1", "2", "3", "4" }:
        exit()
    if yue() == 1:
        break